package com.itstyle.seckill.common.utils;

import java.util.ArrayList;
import java.util.List;

public class TicketSeller1 {
    static List<String> tickets = new ArrayList<>();
    //初始化，放票
    static{
        for(int i=0; i<10000; i++)
            tickets.add("票编号："+i);
    }

    public static void main(String[] args){
        //启动10个线程不断往外卖票
        for(int i=0;i<10;i++){
            new Thread(()->{
                while(tickets.size()>0){
                    System.out.println(Thread.currentThread().getName() + "销售了" +tickets.remove(0));
                }
            }).start();
        }
    }
}